package com.cangxuan.manage.service.impl;

import com.cangxuan.manage.bean.Page;
import com.cangxuan.manage.dao.IUserDao;
import com.cangxuan.manage.dao.IUserLogDao;
import com.cangxuan.manage.entity.User;
import com.cangxuan.manage.entity.UserLog;
import com.cangxuan.manage.service.IUserLogService;
import com.cangxuan.manage.service.IUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class UserLogServiceImpl implements IUserLogService {
    IUserLogDao userLogDao;
    @Autowired
    public void setUserLogDao(IUserLogDao userLogDao) {
        this.userLogDao = userLogDao;
    }


    @Override
    public Page<UserLog> page(int pageIndex, int pageSize, int userId) {
        Page<UserLog> userLogPage = new Page<>(pageIndex, pageSize);
        userLogPage.setRecords(userLogDao.select(pageIndex, pageSize,userId));
        userLogPage.setTotal(userLogDao.selectCount(userId));
        return userLogPage;
    }
}
